﻿using System;

namespace Useful.Document
{
    public enum DocBuilderAutoSize { Content, Fixed, Window };
    public enum HorizontalAligment { Left, Center, Right };
    public enum VerticalAligment { Top, Center, Bottom };
    public enum BorderWeight { Hairline, Medium, Thick, Thin, None }
    public enum DocColor { RED, LIGHTBLUE, GREEN, YELLOW, ORANGE, PINK, LIGHTYELLOW, LIGHTGRAY, GRAY, BLUE}

    public interface IDocBuilder : IDisposable
    {
        void Create(string fileTemplateName);
        void SaveAs(string filename);
        string GetFileName(string filename);

        bool Visible { set; } // Закрывать Excel и после запускать программу просмотра

        void AddTextForTable(string str);
        void ConvertTextToTable(string sname);
        void AutoSizeTable(DocBuilderAutoSize p);

        void SetText(string bookmark, string str);
        void DeleteText(string bookmark);
        string GetCurrentText();
        void AppendText(string str);

        void GoTo(string bookmark);
        void GoTo2(string bookmark);
        void GoToEnd(string bookmark, bool begin);
        void DeleteBookmark(string bookmark);

        void SelectOuter(string bookmark1, string bookmark2);
        bool SelectInner(string bookmark1, string bookmark2);
        object GetCurSelection();
        void DeleteSelection();
        object Selection { get; }

        void AddRow();
        void NextRow();
        void PrevRow();
        void DeleteCurRow();
        void SetCurRowCell(int ind, string str);
        void AutoFitRows();

        void MergeTableCells(int r1, int c1, int r2, int c2);
        void FormatTableColumn(int c, HorizontalAligment? haligment, VerticalAligment? valigment);
        void FormatRange(int r1, int c1, int r2, int c2, HorizontalAligment? haligment, VerticalAligment? valigment);
        void FormatTableCell(int r, int c, HorizontalAligment? haligment, VerticalAligment? valigment, bool? isBold);
        void SetTableColumnWith(int c, float width);
        void SetFormat(int r1, int c1, int r2, int c2, string format);
        void SetBorder(int r1, int c1, int r2, int c2, BorderWeight Weight);
        void SetCellWrap(int r, int c, bool wrap);
        void SetWrap(int r1, int c1, int r2, int c2, bool wrap);
        void SetTableRowHeight(int r, float height);
        void SetTableCurRowHeight(float height);

        void InsertFileAsLink(string bookmark, string fileName);

        void FitToPages();
        string GetAllDocumentText();
        bool IsBookMarkLastInDoc(string bookmark);
        int GetLastPageNumber();
        void SetCurrentRange(object obj);

        void SetTextFormat(string text, bool bold);
        void SetTextSize(string bookmark, float size);

        void Copy();
        void Paste();

        bool CopyTemplateToLocalFolder { get; set; }

        void SetNumber(string bookmark, string str);

        void SetCurRow(int row);
        int GetCurRow();
        int GetCurColumn();

        void SetActivePartition(int partition);

        void FreezePanes(int r, int c);

        void InsertTable(ITable table);
        void InsertTable(ITable table, ITable tags);
        void InsertTable(ITable table, ITable tags, object[] rowTags, object[] colTags);

        void SetRowFontBoldStyle(int r);
        void SetColFontBoldStyle(int c);
        void SetColWrap(int c, bool wrap);
        void SetRowWrap(int r, bool wrap);

        void SetColFormat(int c, string format);
        void CreateColumnGroup(int c1, int c2);

        void SetCellBackColor(int r1, int c1, int r2, int c2, DocColor color);
        void SetColBackColor(int c, DocColor docColor);
        void SetRowBackColor(int r, DocColor docColor);

        void SetBorderOuter(int r1, int c1, int r2, int c2, BorderWeight borderWeight);
        void SetBorderInner(int r1, int c1, int r2, int c2, BorderWeight borderWeight);

        void HideColumn(string bookmark1, string bookmark2);
        void HideColumn(int c);
        void HideCurRow();

        void SetLineSpacing(int size);

        void DeletePartition(int p);

        bool IsCreated { get; set; }

        void SetFontSize(int r1, int c1, int r2, int c2, float size);
        void SetFontName(int r1, int c1, int r2, int c2, string name);
    }
}